-- $Id: xpa-io-tio.ads,v 1.12 2005-12-22 11:43:58 bacon Exp $

generic
	type input_arg_type is private;
	type output_arg_type is private;

	with procedure input_proc (
		user_data: in out input_arg_type; cmd: in integer; 
		text: out standard.string; last: out natural);
	with procedure output_proc (
		user_data: in out output_arg_type; cmd: in integer; 
		text: in standard.string; last: out natural);

package xpa.io.tio is

	-- types
	type tio_type is private;
	type tio_access is access all tio_type;

	-- procedures
	procedure open (tio: in out tio_access);
	procedure close (tio: in out tio_access);

	procedure get (tio: in out tio_access; text: out str; last: out natural);
	procedure put (tio: in out tio_access; text: in str);
	procedure flush (tio: in out tio_access);

private
	subtype tio_buf_type is standard.string(1..1024);

	type tio_type is
	record
		input_arg: input_arg_type;
		output_arg: output_arg_type;

		inbuf: tio_buf_type; -- := (others => ' ');
		outbuf: tio_buf_type;

		inbuf_pos: natural; 
		inbuf_last: natural; -- index to the last character in inbuf
		outbuf_last: natural; -- index to the last character in outbuf

		dynamic: boolean := false;
	end record;

end xpa.io.tio;
